<template>
	<view class="shareInMakingMoney">
		<image src="https://m.aqbwg.cn/sourse/xiaowan/shares.jpg" mode="widthFix" class="bgimgs"> </image>
		<view class="ttbosa">
			<view class="macss">
				<view class="ckisacss">
					<view class="himgda">
						<image src="/static/sjimg/yonghu.png" mode="scaleToFill" class="heimg" v-if="merinfo.imgurl==''||merinfo.imgurl==null"></image>
						<image :src="imgurl+merinfo.imgurl" mode="scaleToFill" class="heimg" v-else></image>
					</view>
					<view class="mntxt">{{ nickname }}</view>
					<uvqrcode ref="qrcode" size="210px" :value="httpUrl"></uvqrcode>
				</view>
			</view>
			<view class="yaocss">
				<view class="ycs1" @click="myInte(1)"> 我的邀请 </view>
				<view class="ycs2"> 请截图保存 </view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { ref } from 'vue';
	import { onLoad } from '@dcloudio/uni-app';
	import { apiMerber } from '@/api/upapi.js';
	import uvqrcode from '@/uni_modules/uv-qrcode/components/uv-qrcode/uv-qrcode';

	const httpUrl = ref('');
	const qrcode = ref('');
	const posterRef = ref('');
	const nickname = ref('微信访客');
	const merinfo = ref('');
	const bgImagePath = ref('https://m.aqbwg.cn/sourse/xiaowan/001.jpg');
	const qrCodeBase64 = ref(''); 
	const imgurl = ref('https://h.foomi.cn:9009/files/upload/');

	// 个人信息
	const initData = async () => {
		const mervalue = uni.getStorageSync('xwmemberId');
		try {
			let res = await apiMerber({
				memberid: mervalue
			});
			if (res.data.result === 0) {
				merinfo.value=res.data.object;
				if(res.data.object.name){ nickname.value=res.data.object.name; };
				const newQrUrl = `https://i.73cc.com:9555/unipay?yaoId=${res.data.object.id}`;
				httpUrl.value = newQrUrl;
				qrcode.value.toTempFilePath({
				 success: (res) => {
					qrCodeBase64.value=res.tempFilePath
				 }
				});
			}
		} catch (error) {}
	};
	const myInte = (e) => { 
		if(e==1){
			uni.navigateTo({ url: '/pagesA/myother/friends' });
		}
	};
	
	onLoad(() => {
		initData();
	});
</script>

<style>
	page{
		background-color: #fff;
	}
</style>
<style lang="scss" scoped>
	.bgimgs{
		z-index: 0;
		position: absolute;
		width: 100%;
	}
	.shareInMakingMoney{
		.ttbosa{
			padding:170rpx 90rpx 40rpx;
			position: relative;
		}
		.yaocss{
			margin-top: 30rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.ycs1{
				padding: 20rpx;
				width: 40%;
				background-color:#ff578b9c;
				color: #fff;
				font-size: 26rpx;
				text-align: center;
				border-radius: 20rpx;
			}
			.ycs2{
				padding: 20rpx;
				width: 40%;
				font-size: 26rpx;
				background-color: #2a62f5ad;
				color: #fff;
				text-align: center;
				border-radius: 20rpx;
			}
		}
		.macss{
			background-color: #ffffffeb;
			padding: 30rpx 60rpx 60rpx;
			border-radius: 30rpx;
			.ckisacss{
				position: relative;
				margin-top: -75rpx;
				display: flex;
				flex-direction: column;
				align-items: center;
			}
			.himgda{
				width:110rpx;
				height:110rpx;
				background-color: #fff;
				display: flex;
				align-items: center;
				justify-content: center;
				border-radius: 110rpx;
				.heimg{
					width:108rpx;
					height:108rpx;
				}
			}
			.mntxt{
				font-size: 28rpx;
				margin:10rpx 0 30rpx;
			}
		}
	}
</style>